<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        #app {
            position: relative;
        }

        .btn_warp {
            width: 50px;
            height: 500px;
            position: absolute;
            top: 20px;
            left: 20px;
        }

        .btn {
            width: 40px;
            height: 40px;
            background: red;
            margin-top: 15px;
            cursor: pointer;
            transition: all 0.3s
        }

        .btn:nth-child(1) {
            background: url("img/1Group.jpg") no-repeat center;
            background-size: 100%;
        }

        .btn:nth-child(2) {
            background: url("img/1DisplayManyPlane.png") no-repeat center;
            background-size: 100%;
        }

        .btn:nth-child(3) {
            background: url("img/1Locate.png") no-repeat center;
            background-size: 100%;
        }

        .btn:nth-child(4) {
            background: url("img/1Search.png") no-repeat center;
            background-size: 100%;
        }

        .co {
            width: 300px;
            height: 400px;
            position: absolute;
            top: 20px;
            left: 45px;
        }

        .search_warp {
            display: inline-block;
            position: relative;
            color: white;
            height: 30px;
            opacity: 0.7;
            z-index: 3;
        }

        .search_warp input {
            outline: none;
            border: none;
            background-color: black;
            border-top-right-radius: 0;
            border-bottom-right-radius: 0;
            display: table-cell;
            height: 30px;
            padding: 0px 10px;
            font-size: 12px;
            width: 180px;
            line-height: 1.5;
            float: left;
            border-radius: 3px;
            position: relative;
            z-index: 2;
            float: left;
            color: #fff;
            margin-bottom: 0
        }

        .search_btn {
            width: 30px;
            height: 30px;
            background: aqua;
            display: inline-block;
            float: left;
            cursor: pointer;

        }

        .name {
            margin-top: 75px;
        }

        .from {
            margin-top: 25px;
            width: 350px;
            padding: 20px 10px;
            background: rgba(000, 000, 000, .6);
            color: #fff;
        }

        .option_name {
            width: 70px;
            display: inline-block;
            text-align: right;
        }

        .select {
            background: rgba(000, 000, 000, .3);
            color: #ffffff;
            margin: 0 3px;
            outline: none;
            padding: 0 4px;
            width: 138px;
        }

        .small_btn {
            width: 17px;
            height: 17px;
            display: inline-block;
            background: red;
            vertical-align: middle;
        }

        .num_input {
            background: rgba(000, 000, 000, .3);
            color: #ffffff;
            margin: 0 3px;
            outline: none;
            padding: 0 4px;
        }

        .small_input {
            width: 70px;
            background: rgba(000, 000, 000, .3);
            color: #ffffff;
            margin: 0 3px;
            outline: none;
            padding: 0 4px;
        }

        .mid_input {
            background: rgba(000, 000, 000, .3);
            color: #ffffff;
            margin: 0 5px;
            outline: none;
            padding: 0 4px;

        }

        .font {
            font-size: 8px
        }

        .margin {
            margin-top: 5px;
        }

        .inline {
            display: inline-block;
            vertical-align: middle;
        }

        .check {
            width: 15px;
            height: 15px;
            margin-top: 5px
        }

        .smallcheck {
            width: 13px;
            height: 13px;

        }

        .small_search {
            float: right;
            display: block;
            width: 20px;
            height: 20px;
            background: red;
        }

        .btn:hover {
            width: 45px;
            height: 45px;
        }
    </style>
    <script src="js/vue.js"></script>
</head>
<body>
<div id="app">
    <div :style="{height:height+'px',width:Width+'px' }"
         style="z-index: -1;position: absolute;min-height: 300px;min-width: 790px">
        <img :src="rooms.image" width="100%" height="100%" alt="">
    </div>
    <div class="btn_warp" style="min-height: 300px">
        <div class="btn"></div>
        <div class="btn"></div>
        <div class="btn"></div>
        <div class="btn"></div>
        <div class="co">
            <div class="search_warp area">
                <input placeholder="输入新增的区域名称">
                <span class="search_btn"></span>
            </div>
            <div class="search_warp name">
                <input placeholder="输入需要查找的机柜名称">
                <span class="search_btn"></span>
            </div>
            <div class="from">
                <h4>空间分布查询</h4>
                <span class="option_name font margin">选择机房</span>
                <select class="select">
                    <option>sd</option>
                    <option>sdsda</option>
                    <option>sdsdasds</option>
                </select><br>
                <div style="overflow: hidden">
                    <span class="option_name font margin">连续空间U数</span>
                    <input type="text" class="num_input">
                    <span class="small_btn"></span>
                    <span class="small_btn"></span>
                </div>
                <div class="from2 margin">
                    <h4>承重状况查询</h4>
                    <div class="font margin">
                        <span>显示承重大于</span><input class="small_input">%小于<input class="small_input">% <span
                            class="small_search"></span>
                        <br>
                    </div>
                    <input type="checkbox" class="inline check">

                    <h4 class="margin inline">用电状况查询</h4>
                    <div class="font margin">
                        <span>显示用电大于</span><input class="small_input">%小于<input class="small_input">%
                        <span class="small_search"></span>
                    </div>
                    <input type="checkbox" class="inline check">
                    <h4 class="margin inline">信息点查询</h4>
                    <div class="font">
                        <div class="margin">
                            <input type="checkbox" class="inline smallcheck">
                            <span>光纤信息点</span><input class="mid_input">个<br>
                        </div>
                        <div class="margin">
                            <input type="checkbox" class="inline smallcheck">
                            <span>以太信息点</span><input class="mid_input">个
                            <span class="small_search"></span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

</div>
</body>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
    const baseUrl = 'http://devdemo.3ddcim.com/'
    new Vue({
        el: '#app',
        data: {
            rooms: [],
            Width: 0,
            height: 0,
            num: 0       //放大或缩小倍数
        },
        created() {
            this.getRomms()
            this.room_cabinets()
            this.dsearchspace()
        },
        mounted() {
            let _this = this
            window.onresize = function () {
                _this.Width = window.innerWidth;
            }
        },
        watch: {
            'Width': function (res) {
                this.num = this.rooms.width / res
                let height = this.rooms.height / this.num
                this.Width = res
                this.height = height
            }
        },
        methods: {
            getRomms: function () {

                let _this = this
                axios.get(baseUrl + 'room_map/rooms.json')
                    .then(function (response) {
                        if (response.status === 200 && response.statusText == "OK") {
                            _this.Width = window.innerWidth;
                            _this.rooms = response.data[0]
                            _this.height = response.data[0].height / (response.data[0].width / _this.Width)
                        }
                        console.log(_this.rooms);
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
            },
            room_cabinets: function () {
                axios.get(baseUrl + 'api/room_cabinets/')
                    .then(function (response) {
                        console.log(response);
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
            },
            dsearchspace: function () {
                axios.get(baseUrl + 'cabinet/3dsearchspace/')
                    .then(function (response) {
                        console.log(response);
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
            }
        }
    })
</script>
</html>